package com.example.demo.web.servlet;


import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

/**
 * 
 * <p>@author Henry.Y</p>
 *
 * <p>@date 2019-07-27</p>
 */
//@WebServlet(name="permissionServlet",urlPatterns="/permission")
public class PermissionServlet extends HttpServlet{

	/**
	 * 
	 */
	private static final long serialVersionUID= -1729615546869930082L;
	
	protected void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
		Subject subject= SecurityUtils.getSubject();
		
		subject.checkPermission("user:create");
		request.getRequestDispatcher("/WEB-INF/jsp/hasPermission.jsp").forward(request, response);
	}

}
